0a624731aed60ece17bd22daef5bc30db7f556e2,src/main/java/com/flexpoker/table/query/handlers/PlayerCalledEventHandler.java,PlayerCalledEventHandler,handleUpdatingTable,#PlayerCalledEvent#,54
Before Change
int callingAmount = callingSeat.getCallAmount();
int updatedTotalPot = currentTable.getTotalPot() + callingAmount;
List<SeatDTO> updatedSeats = new ArrayList<>();
for (SeatDTO seatDTO : currentTable.getSeats()) {
if (seatDTO.getName().equals(username)) {
int updatedChipsInFront = seatDTO.getChipsInFront() + callingAmount;
int updatedChipsInBack = seatDTO.getChipsInBack() - callingAmount;
updatedSeats.add(new SeatDTO(seatDTO.getPosition(),
seatDTO.getName(), updatedChipsInBack, updatedChipsInFront,
seatDTO.isStillInHand(), 0, 0, seatDTO.isButton(),
seatDTO.isSmallBlind(), seatDTO.isBigBlind(), false));
} else {
updatedSeats.add(seatDTO);
}
}
After Change
int callingAmount = callingSeat.getCallAmount();
int updatedTotalPot = currentTable.getTotalPot() + callingAmount;
List<SeatDTO> updatedSeats = currentTable.getSeats().stream()
.map(seatDTO -> {
if (seatDTO.getName().equals(username)) {
int updatedChipsInFront = seatDTO.getChipsInFront() + callingAmount;
int updatedChipsInBack = seatDTO.getChipsInBack() - callingAmount;
return new SeatDTO(seatDTO.getPosition(),
seatDTO.getName(), updatedChipsInBack, updatedChipsInFront,
seatDTO.isStillInHand(), 0, 0, seatDTO.isButton(),
seatDTO.isSmallBlind(), seatDTO.isBigBlind(), false);
}
return seatDTO;
}).collect(Collectors.toList());
Set<PotDTO> updatePots = new HashSet<>();